package com.example.nonggo.bean;

import org.json.JSONObject;

import okhttp3.MediaType;
import okhttp3.RequestBody;

public class BdsoundDTO {

    private String format;
    private String speech;
    private long len;
    private long rate;

    public BdsoundDTO(String speech, long len) {
        this.speech = speech;
        this.len = len;
        this.format = "m4a";
        this.rate = 16000;
    }
    public RequestBody toRequestBody(){
        JSONObject j = new JSONObject();
        try {
            j.put("format", format);
            j.put("speech", speech);
            j.put("len", len);
            j.put("rate", rate);
        } catch (Exception ignore) {
        }
        return RequestBody.create(MediaType.parse("application/json"), j.toString());
    }

    public String getFormat() {
        return format;
    }

    public void setFormat(String format) {
        this.format = format;
    }

    public String getSpeech() {
        return speech;
    }

    public void setSpeech(String speech) {
        this.speech = speech;
    }

    public long getLen() {
        return len;
    }

    public void setLen(long len) {
        this.len = len;
    }

    public long getRate() {
        return rate;
    }

    public void setRate(long rate) {
        this.rate = rate;
    }
}
